<div class="hp-tab-newprd">
    <?php if(!is_iframe()){?>
    <ul class="j-sw-nav">
        <li class="newprd-s1 tab-li"><a href="<?php echo base_path();?>retailstore/list">查看</a></li>
        <?php if(user_access('add retailstore')){ ?>
        <li class="newprd-s2 tab-li<?php if(arg(1) == 'add'){?> on <?php }?>"><a href="<?php echo base_path();?>retailstore/add">添加</a></li>
        <?php } if(arg(1) == 'edit' && !empty(arg(2))){?>
            <li class="newprd-s3 tab-li on"><a href="javascript:void(0)">修改</a></li>
        <?php }?>
    </ul>
    <?php }?>
    <style>
        .form-type-managed-file{border:0px;}
    </style>
    <div class="table-div" >
        <?php  print _address_render_for_add($form)?>
        <?php if(arg(1) != 'edit'){ ?>
        <div style = '<?php if(arg(1) == 'edit'){ echo "display:none;"; }?>'>
            <div class="form-label">导入门店信息:</div><?php print render($form['upload_file']['file_upload_store']); ?>
            <span style="margin-left:80px">(注:请选择上传的excel文件)</span>
            <div style="text-align: left;margin-bottom: 10px;margin-left: 150px;<?php if(arg(1) == 'edit'){ echo "display:none;"; }?>"><?php print render($form['upload_file']['submit']); ?></div>
        </div>
        <?php }?>
        <div class="small-select small-input column" style="clear:both">
            <div class="small-div"><div class="form-label"><span class="required">*</span>详细地址:</div><?php print render($form['retailstore']['details']); ?></div>
            <div class="small-div"><div class="form-label"><span class="required">*</span>基层商姓名:</div><?php print render($form['retailstore']['name']); ?></div>
        </div>
        <div class="small-select small-input column" style="clear:both">
            <div class="small-div"><div class="form-label"><span class="required">*</span>电话:</div><?php print render($form['retailstore']['tel']); ?></div>
        </div>
<!--        <div class="small-select small-input column" style="clear:both">-->
<!--            <div class="form-label">化肥品种:</div>--><?php //print render($form['retailstore_sacfvariety']['sacfvariety']); ?>
<!--        </div>-->
        <div  style="clear:both">

                <div class="form-label">化肥品牌:</div>
                <div class="checkboxes-row"><?php print render($form['brands']); ?></div>

        </div>
        <div class="small-select small-input column" style="clear:both">
            <div class="small-div" ><div class="form-label">门头长度(米):</div><?php print render($form['retailstore']['width']); ?></div>
            <div class="small-div"><div class="form-label">门头高度(米):</div><?php print render($form['retailstore']['height']); ?></div>
        </div>
        <div class="small-select small-input column" style="clear:both">
            <div class="small-div"><div class="form-label"><span class="required">*</span>种植面积(亩):</div><?php print render($form['retailstore_plant']['area']); ?></div>
        </div>
        <div  style="clear:both">
            <div class="form-label">上传图片:</div>
            <div style="width: 40%;float: left; margin-right: 10px;  border: 1px solid #ccc;"><?php print render($form['file_upload1']);?></div>
            <div style="width: 40%;float: left;  border: 1px solid #ccc;"><?php print render($form['file_upload2']);?></div>
            <div class="form-label">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</div>
            <div style="width: 40%;float: left;margin-top: 10px;  border: 1px solid #ccc;"><?php print render($form['file_upload3']);?></div>
            <div class="form-label"><span class="required">*</span>主要作物:</div>
            <div style="float: left;">
            <?php
            $result_category = db_select('plant_category', 'b')
                ->fields('b', array('plant_category_id', 'plant_category_name'))
                ->execute();
            foreach($result_category as $category){
//                print "<div style='clear:both'>";
                print '<div style="clear: both;text-align:center">'.$category->plant_category_name.'</div>';
                print '<div class="checkboxes-row">'.render($form['plants'][$category->plant_category_name]).'</div>';
//                print "</div>";
            }
            ?>
            </div>
        </div>

<!--        <div class="middle-select small-input column" style="clear:both">-->
<!--            <div class="small-input address-search">--><?php //print render($form['retailstore_plant']['plant']); ?><!--</div>-->
<!--        </div>-->

        <div style="clear: both;"></div>
        <?php

        foreach($form['#retailstore_sales']['#value'] as $key=>$value){
            $html ='<div class="fertilization-div '.$value->retailstore_sales_id.'"><div class="fertilization-title">'.$value->year.'销售量';
            $html .= '<span class="fertilization-delete" onclick="delete_retailstore(\'retailstore_sales\',\''.$value->retailstore_sales_id.'\')">-</span></div>';
            $html .= '<ul><li>年份:'.$value->year."</li>";
            $html .= '<li>销量(吨):'.$value->sales."</li><li></li><li></li></ul></div>";
            $retailstore_id  = $value->retailstore_id;
            print render($html);
        }
        ?>
        <div class="fertilization-div add-fertilization-div" id='add-fertilizer-info' data-toggle="modal" data-target="#retailstoreExtraModal">
            <div class="fertilization-title"><span style="font-weight: bold">继续添加门店销量</span></div>
            <span class="add-fertilization">+</span></div>
        <div class="add-submit" style="text-align: center"><?php print render($form['submit']); ?></div>
    </div>
</div>

<?php print drupal_render_children($form); ?>
</div></form>
<div>
    <div class="modal fade" id="retailstoreExtraModal" tabindex="-1" role="dialog" aria-labelledby="retailstoreExtraModal" aria-hidden="true">
        <div class="modal-dialog">
            <div class="modal-content">
                <div class="modal-header">
                    <button type="button" class="close"
                            data-dismiss="modal" aria-hidden="true">
                        &times;
                    </button>
                    <h4 class="modal-title" id="myModalLabel">
                        门店销售
                    </h4>
                </div>
                <div class="modal-body">
                    <?php echo @render(drupal_get_form('retailstore_extra_edit_form','retailstore_sales','retailstore_id'));?>
                </div>
                <!--                <div class="modal-footer">-->
                <!--                    <button type="button" class="btn btn-default"-->
                <!--                            data-dismiss="modal">关闭-->
                <!--                    </button>-->
                <!---->
                <!--                </div>-->
            </div><!-- /.modal-content -->
        </div><!-- /.modal -->
    </div>
</div>
<form><div>
